<?php defined('SYSPATH') OR die('No direct access allowed.');

/**
 *
 * Заготовка для библиотеки Supervisor
 *
 *
 */

class Supervisor {


	public static function factory($config_name = 'default')
	{
		return new Supervisor($config_name);
	}

	/**
	 * Return a static instance of Supervisor.
	 *
	 * @return  object
	 */
	public static function instance($config_name = 'default')
	{
		static $instance;

		empty($instance[$config_name]) and $instance[$config_name] = new Supervisor($config_name);

		return $instance[$config_name];
	}

	public function __construct($config_name = 'default')
	{
		$this->config_name     = $config_name;
		$this->session 				 = Session::instance();
		$this->config          = Kohana::config('supervisor');
		$this->acl = A2::instance($this->config['acl_profile']);

		Kohana::log('debug', 'Supervisor Library loaded');
	}

	public function can_add_post()
	{
		//return A2::instance($this->config['acl_profile'])->allowed('post', 'add');
		return true;
	}

	public function can_add_comment($id)
	{
		//var_dump(A2::instance($this->config['acl_profile']));
		//return A2::instance($this->config['acl_profile'])->allowed('comment', 'add');
		
		return true;
	}

	public function can_delete_post($id)
	{
		//return A2::instance($this->config['acl_profile'])->allowed('post', 'delete');
		return true;
	}

	public function can_edit_post($id)
	{
		//return A2::instance($this->config['acl_profile'])->allowed('post', 'edit');
		return true;
	}

	public function can_delete_comment($id)
	{
		//return A2::instance($this->config['acl_profile'])->allowed('comment', 'delete');
		return true;
	}

	public function can_edit_comment($id)
	{
		//return A2::instance($this->config['acl_profile'])->allowed('comment', 'edit');
		return true;
	}
}